#include "MenuDrawer.h"
#include "FontRender2D.h"

MenuDrawer::MenuDrawer(void)
{
	menuPosition = 0;
}

MenuDrawer::~MenuDrawer(void)
{
}

void MenuDrawer::DrawMenu()
{
	FontRender2D * fr = FontRender2D::Instance();


	//for(vector<wstring>::iterator iter = menuItems.begin(); iter != menuItems.end(); iter++)
	for(int i = 0; i < menuItems.size(); i++)
	{
		if( menuPosition == i )
			fr->DrawText(0,50 + (i * 20), DT_CENTER, menuItems[i], 0xFF00FFFF);
		else
			fr->DrawText(0,50 + (i * 20), DT_CENTER, menuItems[i]);
	}
	//	
}

void MenuDrawer::AddMenuItem(wstring itemName)
{
	menuItems.push_back(itemName);
}
//up is minus
void MenuDrawer::MoveUp()
{
	menuPosition = (menuPosition - 1) % menuItems.size();
}

//down is positive
void MenuDrawer::MoveDown()
{
	menuPosition = (menuPosition + 1) % menuItems.size();
}

wstring MenuDrawer::GetSelectedItem()
{
	return menuItems[menuPosition];
}